#!/bin/bash -e

UserID=${1}
OSVer=${2}
OSMainline=${3}

OutPrefix="Pre Actions"
echo "${OutPrefix}: ARGS [${UserID}] [${OSVer}] [${OSMainline}]"

[ -n "${UserID}" ] || (echo "UserID is empty!"; exit 1)
[ -n "${OSVer}" ] || (echo "OSVer is empty!"; exit 1)

User=$(id -n -u "${UserID}")
[ -n "${User}" ] || (echo "User is empty!"; exit 1)
Home=$(awk -F ':' "/^${User}/ {print \$6}" /etc/passwd)
[ -n "${User}" ] || (echo "Home is empty!"; exit 1)

echo "User: ${User}, Home Dir: ${Home}"

